import request from "@/utils/request";
//获取商品列表
export function getProducts(per = 10, page = 1) {
  return request({
    url: "/api/v1/admin/products",
    method: "get",
    params: {
      per,
      page,
    },
  });
}
//获取单个商品
export function getPerProduct(id) {
  return request({
    url: "/api/v1/admin/products/" + id,
    method: "get",
  });
}
//新增商品
export function jiaProduct(data) {
  return request({
    url: "/api/v1/admin/products", //需要把接口换成自己服务器的接口
    method: "post",
    data,
  });
}
//修改商品信息
export function xiugaiProduct(id, data) {
  return request({
    url: "/api/v1/admin/products/" + id,
    method: "put",
    data,
  });
}
//删除商品
export function deleteProduct(id) {
  return request({
    url: "/api/v1/admin/products/" + id,
    method: "delete",
  });
}
